﻿using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.GameSystem;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	// Token: 0x02000E5D RID: 3677
	internal class XSkillTreeView : DlgBase<XSkillTreeView, XSkillTreeBehaviour>
	{
		// Token: 0x1700347C RID: 13436
		// (get) Token: 0x0600C4E8 RID: 50408 RVA: 0x002B2E04 File Offset: 0x002B1004
		public override string fileName
		{
			get
			{
				return "GameSystem/SkillTree";
			}
		}

		// Token: 0x1700347D RID: 13437
		// (get) Token: 0x0600C4E9 RID: 50409 RVA: 0x002B2E1C File Offset: 0x002B101C
		public override int layer
		{
			get
			{
				return 1;
			}
		}

		// Token: 0x1700347E RID: 13438
		// (get) Token: 0x0600C4EA RID: 50410 RVA: 0x002B2E30 File Offset: 0x002B1030
		public override bool pushstack
		{
			get
			{
				return true;
			}
		}

		// Token: 0x1700347F RID: 13439
		// (get) Token: 0x0600C4EB RID: 50411 RVA: 0x002B2E44 File Offset: 0x002B1044
		public override bool fullscreenui
		{
			get
			{
				return true;
			}
		}

		// Token: 0x17003480 RID: 13440
		// (get) Token: 0x0600C4EC RID: 50412 RVA: 0x002B2E58 File Offset: 0x002B1058
		public override bool hideMainMenu
		{
			get
			{
				return true;
			}
		}

		// Token: 0x17003481 RID: 13441
		// (get) Token: 0x0600C4ED RID: 50413 RVA: 0x002B2E6C File Offset: 0x002B106C
		public override bool autoload
		{
			get
			{
				return true;
			}
		}

		// Token: 0x0600C4EE RID: 50414 RVA: 0x002B2E80 File Offset: 0x002B1080
		protected override void Init()
		{
			base.Init();
			this._doc = XDocuments.GetSpecificDocument<XSkillTreeDocument>(XSkillTreeDocument.uuID);
			this._doc.CurrentSkillID = this._doc.UNSELECT;
			this._SwitchFrameState = true;
			this.SetupTabs();
			base.uiBehaviour.m_FreeResetSkillTip.SetText(string.Format(XStringDefineProxy.GetString("SKILL_RESETFREE_TIPS"), XSingleton<XGlobalConfig>.singleton.GetInt("FreeResetSkillLevel")));
			this._skillDlgPromoteHandler = DlgHandlerBase.EnsureCreate<SkillDlgPromoteHandler>(ref this._skillDlgPromoteHandler, base.uiBehaviour.m_TransferFrame, null, false);
		}

		// Token: 0x0600C4EF RID: 50415 RVA: 0x002B2F1C File Offset: 0x002B111C
		public override void RegisterEvent()
		{
			base.RegisterEvent();
			base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked));
			base.uiBehaviour.m_ResetSkillBtn.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnResetSkillPointClicked));
			base.uiBehaviour.m_ResetProBtn.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnResetProfClicked));
			base.uiBehaviour.m_SwitchSkillPageBtn.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSwitchSkillPageBtnClick));
			base.uiBehaviour.m_CatchBackBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.TurnSwitchFrameState));
			base.uiBehaviour.m_ChooseBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.TurnSwitchFrameState));
			base.uiBehaviour.m_SkillPlayBtn.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnPlaySkillClicked));
			base.uiBehaviour.m_LearnBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSkillLevelUpClicked));
			for (int i = 0; i < XSkillTreeDocument.SkillSlotCount; i++)
			{
				base.uiBehaviour.m_SkillSlotList[i].RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSetupSkillClicked));
			}
		}

		// Token: 0x0600C4F0 RID: 50416 RVA: 0x002B3050 File Offset: 0x002B1250
		public void SetupTabs()
		{
			uint typeID = XSingleton<XAttributeMgr>.singleton.XPlayerData.TypeID;
			uint level = XSingleton<XAttributeMgr>.singleton.XPlayerData.Level;
			base.uiBehaviour.m_Tabs.ReturnAll(false);
			Vector3 tplPos = base.uiBehaviour.m_Tabs.TplPos;
			bool tab_enabled = true;
			this._icbList.Clear();
			this._TabRedPointList.Clear();
			XSingleton<XDebug>.singleton.AddWarningLog("XSkillTreeView SetupTabs TypeID:" + typeID);
			for (int i = 0; i < this._doc.TRANSFERNUM; i++)
			{
				uint profession = typeID % 10U;
				typeID /= 10U;
				string inputText;
				if (profession == 0U)
				{
					if (i == XSkillTreeView.AwakeIndex)
					{
						inputText = XStringDefineProxy.GetString("SKILL_TREE_TAB_AWAKE");
					}
					else
					{
						string arg = (i == 1) ? XStringDefineProxy.GetString("ONE") : XStringDefineProxy.GetString("TWO");
						string arg2 = (level >= this._doc.TransferLimit[i]) ? "" : XLabelSymbolHelper.FormatImage("common/Lcommon", "l_lock_00");
						inputText = string.Format(XStringDefineProxy.GetString("SKILL_TREE_TAB"), arg2, this._doc.TransferLimit[i], arg);
					}
				}
				else
				{
					int profID = (int)(XSingleton<XAttributeMgr>.singleton.XPlayerData.TypeID % (uint)this.MI[i + 1]);
					inputText = XSingleton<XProfessionSkillMgr>.singleton.GetProfName(profID);
				}
				GameObject gameObject = base.uiBehaviour.m_Tabs.FetchGameObject(false);
				gameObject.transform.localPosition = new Vector3(tplPos.x, tplPos.y - (float)(base.uiBehaviour.m_Tabs.TplHeight * i));
				this._TabRedPointList.Add(gameObject.transform.Find("RedPoint").gameObject);
				IXUILabelSymbol ixuilabelSymbol = gameObject.transform.Find("TextLabel").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
				ixuilabelSymbol.InputText = inputText;
				IXUILabelSymbol ixuilabelSymbol2 = gameObject.transform.Find("SelectedTextLabel").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
				ixuilabelSymbol2.InputText = inputText;
				IXUICheckBox ixuicheckBox = gameObject.GetComponent("XUICheckBox") as IXUICheckBox;
				IXUISprite ixuisprite = gameObject.transform.Find("Lock").GetComponent("XUISprite") as IXUISprite;
				this._icbList.Add(ixuicheckBox);
				ixuicheckBox.ID = (ulong)((long)i);
				if (tab_enabled)
				{
					gameObject.GetComponent<BoxCollider>().enabled = true;
					ixuicheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnTabClick));
					ixuisprite.RegisterSpriteClickEventHandler(null);
				}
				else
				{
					gameObject.GetComponent<BoxCollider>().enabled = false;
					ixuicheckBox.RegisterOnCheckEventHandler(null);
					ixuisprite.ID = (ulong)this._doc.TransferLimit[i - 1];
					ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnUnableCheckBoxClick));
				}
				if (profession == 0U)
				{
					tab_enabled = false;
				}
			}
		}

		// Token: 0x0600C4F1 RID: 50417 RVA: 0x002B3368 File Offset: 0x002B1568
		protected override void OnShow()
		{
			base.OnShow();
			XSingleton<XCombatEffectManager>.singleton.ArrangeEffectData();
			this._doc.CreateSkillBlackHouse();
			if (this.skillPreView == null)
			{
				this.skillPreView = new RenderTexture(369, 208, 1, 0, 0);
				this.skillPreView.name = "SkillPreview";
				this.skillPreView.autoGenerateMips = false;
				this.skillPreView.Create();
			}
			base.uiBehaviour.m_Snapshot.SetRuntimeTex(this.skillPreView, true);
			this._doc.SetSkillPreviewTexture(this.skillPreView);
			this.SetUVRectangle();
			this._icbList[this.LastSelectPromote].bChecked = true;
			this.OnTabClick(this._icbList[this.LastSelectPromote]);
			if (!this._SwitchFrameState)
			{
				this.TurnSwitchFrameState(null);
			}
			this.CalAllTabRedPoint();
		}

		// Token: 0x0600C4F2 RID: 50418 RVA: 0x002B3468 File Offset: 0x002B1668
		protected override void OnHide()
		{
			this._doc.DelDummy();
			if (this._doc.BlackHouseCamera != null)
			{
				this._doc.BlackHouseCamera.enabled = false;
			}
			this.LastSelectPromote = 0;
			this._skillDlgPromoteHandler.SetVisible(false);
			this._doc.SetSkillPreviewTexture(null);
			if (this.skillPreView != null)
			{
				base.uiBehaviour.m_Snapshot.SetRuntimeTex(null, true);
				this.skillPreView = null;
			}
			this.DestroyFx(this._FxFirework);
			this._FxFirework = null;
			base.uiBehaviour.m_LevelUpFx.SetActive(false);
			base.OnHide();
		}

		// Token: 0x0600C4F3 RID: 50419 RVA: 0x002B3523 File Offset: 0x002B1723
		public override void LeaveStackTop()
		{
			base.LeaveStackTop();
			base.uiBehaviour.m_LevelUpFx.SetActive(false);
		}

		// Token: 0x0600C4F4 RID: 50420 RVA: 0x002B3540 File Offset: 0x002B1740
		protected override void OnUnload()
		{
			XSingleton<XSkillPreViewMgr>.singleton.SkillShowEnd(this._doc.Dummy);
			if (this._doc.BlackHouseCamera != null)
			{
				this._doc.BlackHouseCamera.enabled = false;
			}
			this._doc.SetSkillPreviewTexture(null);
			if (this.skillPreView != null)
			{
				this.skillPreView.Release();
				this.skillPreView = null;
			}
			this.LastSelectPromote = 0;
			this._LastSelect = null;
			DlgHandlerBase.EnsureUnload<SkillDlgPromoteHandler>(ref this._skillDlgPromoteHandler);
			this.DestroyFx(this._FxFirework);
			this._FxFirework = null;
			base.OnUnload();
		}

		// Token: 0x0600C4F5 RID: 50421 RVA: 0x002B35F4 File Offset: 0x002B17F4
		public void CalAllTabRedPoint()
		{
			for (int i = 0; i < this._doc.TRANSFERNUM; i++)
			{
				this.CalTabRedPoint(i);
			}
		}

		// Token: 0x0600C4F6 RID: 50422 RVA: 0x002B3624 File Offset: 0x002B1824
		private void CalTabRedPoint(int Promote)
		{
			if (XSingleton<XAttributeMgr>.singleton.XPlayerData.TypeID / (uint)this.MI[Promote] == 0U)
			{
				this._TabRedPointList[Promote].SetActive(false);
			}
			else
			{
				int profID = (int)(XSingleton<XAttributeMgr>.singleton.XPlayerData.TypeID % (uint)this.MI[Promote + 1]);
				List<uint> profSkillID = XSingleton<XSkillEffectMgr>.singleton.GetProfSkillID(profID);
				for (int i = 0; i < profSkillID.Count; i++)
				{
					uint skillOriginalLevel = XSingleton<XAttributeMgr>.singleton.XPlayerData.SkillLevelInfo.GetSkillOriginalLevel(profSkillID[i]);
					SkillList.RowData skillConfig = XSingleton<XSkillEffectMgr>.singleton.GetSkillConfig(profSkillID[i], skillOriginalLevel);
					if (this._doc.CheckRedPoint(profSkillID[i]))
					{
						this._TabRedPointList[Promote].SetActive(true);
						return;
					}
				}
				this._TabRedPointList[Promote].SetActive(false);
			}
		}

		// Token: 0x0600C4F7 RID: 50423 RVA: 0x002B3720 File Offset: 0x002B1920
		private bool OnTabClick(IXUICheckBox icb)
		{
			bool result;
			if (!icb.bChecked)
			{
				result = true;
			}
			else
			{
				if (this._LastSelect != null)
				{
					this._LastSelect.SetActive(false);
				}
				this.Refresh((int)icb.ID, true, true);
				result = true;
			}
			return result;
		}

		// Token: 0x0600C4F8 RID: 50424 RVA: 0x002B3774 File Offset: 0x002B1974
		private bool OnCloseClicked(IXUIButton button)
		{
			this.SetVisibleWithAnimation(false, null);
			return true;
		}

		// Token: 0x0600C4F9 RID: 50425 RVA: 0x002B3790 File Offset: 0x002B1990
		public void Refresh(int Promote, bool resetCurrentSkill = false, bool resetPosition = true)
		{
			this.LastSelectPromote = Promote;
			this._icbList[Promote].bChecked = true;
			int typeID = (int)XSingleton<XAttributeMgr>.singleton.XPlayerData.TypeID;
			int num = typeID / this.MI[Promote] % 10;
			if (num != 0)
			{
				if (resetCurrentSkill)
				{
					this._doc.CurrentSkillID = this._doc.UNSELECT;
				}
				this.ShowSkillTreeFrame(Promote);
			}
			else
			{
				this.ShowTransferFrame(Promote);
			}
			this.SetOtherInfo(Promote == XSkillTreeView.AwakeIndex);
			if (resetPosition)
			{
				base.uiBehaviour.m_SkillTreeScrollView.ResetPosition();
			}
		}

		// Token: 0x0600C4FA RID: 50426 RVA: 0x002B3835 File Offset: 0x002B1A35
		public void ShowSkillTreeFrame(int Promote)
		{
			this.IsPromoteHandlerShow = false;
			this._skillDlgPromoteHandler.SetVisible(false);
			this.SetupSkillFrame(Promote);
		}

		// Token: 0x0600C4FB RID: 50427 RVA: 0x002B3854 File Offset: 0x002B1A54
		private void ShowTransferFrame(int Promote)
		{
			this.IsPromoteHandlerShow = true;
			this._skillDlgPromoteHandler.IsShowAwake = (Promote == XSkillTreeView.AwakeIndex);
			this._skillDlgPromoteHandler.CurrStage = Promote;
			this._skillDlgPromoteHandler.SetVisible(true);
		}

		// Token: 0x0600C4FC RID: 50428 RVA: 0x002B388A File Offset: 0x002B1A8A
		private void OnPlaySkillClicked(IXUISprite sp)
		{
			base.uiBehaviour.m_SkillPlayBtn.SetVisible(false);
			XSingleton<XSkillPreViewMgr>.singleton.ShowSkill(this._doc.Dummy, this._doc.CurrentSkillID, 0U);
		}

		// Token: 0x0600C4FD RID: 50429 RVA: 0x002B38C4 File Offset: 0x002B1AC4
		private bool OnSkillLevelUpClicked(IXUIButton button)
		{
			this._doc.SendSkillLevelup();
			return true;
		}

		// Token: 0x0600C4FE RID: 50430 RVA: 0x002B38E4 File Offset: 0x002B1AE4
		public void SetupSkillFrame(int Promote)
		{
			if (base.IsVisible())
			{
				int profID = (int)(XSingleton<XAttributeMgr>.singleton.XPlayerData.TypeID % (uint)this.MI[Promote + 1]);
				base.uiBehaviour.m_SkillPool.ReturnAll(false);
				base.uiBehaviour.m_ArrowPool.ReturnAll(false);
				List<uint> profSkillID = XSingleton<XSkillEffectMgr>.singleton.GetProfSkillID(profID);
				List<SkillTreeSortItem> list = new List<SkillTreeSortItem>();
				for (int i = 0; i < profSkillID.Count; i++)
				{
					SkillTreeSortItem skillTreeSortItem = new SkillTreeSortItem();
					skillTreeSortItem.skillID = profSkillID[i];
					SkillList.RowData skillConfig = XSingleton<XSkillEffectMgr>.singleton.GetSkillConfig(profSkillID[i], 0U);
					skillTreeSortItem.x = (int)skillConfig.XPostion;
					skillTreeSortItem.y = (int)skillConfig.YPostion;
					list.Add(skillTreeSortItem);
				}
				list.Sort(new Comparison<SkillTreeSortItem>(this.Compare));
				int num = 0;
				for (int j = 0; j < list.Count; j++)
				{
					GameObject gameObject = base.uiBehaviour.m_SkillPool.FetchGameObject(false);
					gameObject.name = string.Format("Skill{0}", ++num);
					this.SetupSkill(gameObject, list[j].skillID);
				}
			}
		}

		// Token: 0x0600C4FF RID: 50431 RVA: 0x002B3A3C File Offset: 0x002B1C3C
		private void SetOtherInfo(bool isAwake = false)
		{
			base.uiBehaviour.m_FreeResetSkillTip.SetVisible((ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level < (ulong)((long)XSingleton<XGlobalConfig>.singleton.GetInt("FreeResetSkillLevel")));
			int num = (int)XSingleton<XGame>.singleton.Doc.XBagDoc.GetSkillPointCount(false);
			base.uiBehaviour.m_UseSkillPoint.SetText(string.Format("{0}/{1}", num, this._doc.TotalSkillPoint));
			base.uiBehaviour.m_UseAwakeSkillPoint.SetText(string.Format("{0}/{1}", (int)XSingleton<XGame>.singleton.Doc.XBagDoc.GetSkillPointCount(true), this._doc.TotalAwakeSkillPoint));
			base.uiBehaviour.m_LeftSkillPoint.SetText(num.ToString());
			base.uiBehaviour.m_ResetProBtn.SetEnabled(XSingleton<XAttributeMgr>.singleton.XPlayerData.TypeID > 10U);
			base.uiBehaviour.m_ResetSkillBtn.SetEnabled((isAwake ? this._doc.TotalAwakeSkillPoint : this._doc.TotalSkillPoint) - (int)XSingleton<XGame>.singleton.Doc.XBagDoc.GetSkillPointCount(isAwake) != 1);
			base.uiBehaviour.m_SwitchSkillPageBtn.SetGrey((ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level >= (ulong)((long)this._doc.SkillPageOpenLevel));
			base.uiBehaviour.m_SkillPageText.SetEnabled((ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level >= (ulong)((long)this._doc.SkillPageOpenLevel));
			base.uiBehaviour.m_SkillPageText.SetText(XStringDefineProxy.GetString(string.Format("SkillPage{0}", 1U - XSingleton<XAttributeMgr>.singleton.XPlayerData.SkillPageIndex)));
		}

		// Token: 0x0600C500 RID: 50432 RVA: 0x002B3C2C File Offset: 0x002B1E2C
		protected void SetupSkill(GameObject go, uint skillID)
		{
			uint skillOriginalLevel = XSingleton<XAttributeMgr>.singleton.XPlayerData.SkillLevelInfo.GetSkillOriginalLevel(skillID);
			SkillList.RowData skillConfig = XSingleton<XSkillEffectMgr>.singleton.GetSkillConfig(skillID, skillOriginalLevel);
			SkillList.RowData rowData = null;
			if (skillConfig.PreSkill != null && skillConfig.PreSkill != "")
			{
				uint skillID2 = XSingleton<XSkillEffectMgr>.singleton.GetSkillID(skillConfig.PreSkill, 0U);
				rowData = XSingleton<XSkillEffectMgr>.singleton.GetSkillConfig(skillID2, 0U);
			}
			int skillMaxLevel = XSingleton<XSkillEffectMgr>.singleton.GetSkillMaxLevel(skillID, 0U);
			SkillTypeEnum skillType = (SkillTypeEnum)skillConfig.SkillType;
			IXUISprite ixuisprite = go.GetComponent("XUISprite") as IXUISprite;
			IXUISprite ixuisprite2 = go.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
			IXUISprite ixuisprite3 = go.transform.Find("Icon/P").GetComponent("XUISprite") as IXUISprite;
			IXUILabel ixuilabel = go.transform.Find("Text").GetComponent("XUILabel") as IXUILabel;
			IXUISprite ixuisprite4 = go.transform.Find("Tip").GetComponent("XUISprite") as IXUISprite;
			IXUILabel ixuilabel2 = go.transform.Find("LockTip").GetComponent("XUILabel") as IXUILabel;
			IXUISprite ixuisprite5 = go.transform.Find("Lock").GetComponent("XUISprite") as IXUISprite;
			GameObject gameObject = go.transform.Find("Select").gameObject;
			ixuisprite.ID = (ulong)skillID;
			ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSkillClicked));
			if (this._doc.CurrentSkillID == this._doc.UNSELECT || this._doc.CurrentSkillID == skillID)
			{
				gameObject.SetActive(true);
				this._doc.CurrentSkillID = skillID;
				this.OnSkillClicked(ixuisprite);
				this._LastSelect = gameObject;
			}
			else
			{
				gameObject.SetActive(false);
			}
			Transform transform = go.transform.Find("CanLearn");
			Transform transform2 = go.transform.Find("RedPoint");
			transform.gameObject.SetActive(false);
			transform2.gameObject.SetActive(false);
			if ((skillType == SkillTypeEnum.Skill_Normal || skillType == SkillTypeEnum.Skill_Big || skillType == SkillTypeEnum.Skill_Buff) && this._doc.SkillIsEquip(skillID))
			{
				ixuisprite4.SetVisible(true);
			}
			else
			{
				ixuisprite4.SetVisible(false);
			}
			go.transform.localPosition = new Vector3(base.uiBehaviour.m_SkillPool.TplPos.x + (float)((int)(skillConfig.XPostion - 1) * base.uiBehaviour.m_SkillPool.TplWidth), (float)skillConfig.YPostion);
			ixuisprite2.SetSprite(skillConfig.Icon, skillConfig.Atlas, false);
			ixuilabel2.SetVisible(this._doc.CheckPreSkillLevel(skillID) != 0 && !this._doc.CanSkillLevelUp(skillID, skillOriginalLevel, 0) && skillOriginalLevel == 0U);
			ixuilabel.SetVisible((this._doc.CheckPreSkillLevel(skillID) != 0 && this._doc.CanSkillLevelUp(skillID, skillOriginalLevel, 0)) || skillOriginalLevel > 0U);
			ixuilabel.SetText(skillOriginalLevel + "/" + skillMaxLevel);
			if (skillOriginalLevel == 0U && !this._doc.CanSkillLevelUp(skillID, skillOriginalLevel, 0))
			{
				ixuilabel2.SetText(string.Format(XStringDefineProxy.GetString(XStringDefine.SKILL_LEARN), skillConfig.UpReqRoleLevel[0]));
			}
			else
			{
				bool flag5 = this._doc.CheckFx(skillID);
				bool flag6 = this._doc.CheckRedPoint(skillID);
				bool flag7 = this._doc.CheckNew(skillID);
				IXUISprite ixuisprite6 = transform2.transform.Find("Fx").GetComponent("XUISprite") as IXUISprite;
				IXUISprite ixuisprite7 = transform2.transform.Find("Fx1").GetComponent("XUISprite") as IXUISprite;
				ixuisprite6.SetVisible(false);
				ixuisprite7.SetVisible(false);
				if (flag7)
				{
					transform2.gameObject.SetActive(true);
					ixuisprite6.SetVisible(true);
				}
				if (flag5 && !flag6)
				{
					transform.gameObject.SetActive(true);
				}
				if (flag6)
				{
					transform2.gameObject.SetActive(true);
					ixuisprite7.SetVisible(true);
				}
			}
			SkillTypeEnum skillTypeEnum = skillType;
			if (skillTypeEnum != SkillTypeEnum.Skill_Big)
			{
				if (skillTypeEnum != SkillTypeEnum.Skill_Buff)
				{
					ixuisprite3.SetSprite("JN_dk");
				}
				else
				{
					ixuisprite3.SetSprite("JN_dk_buff");
				}
			}
			else
			{
				ixuisprite3.SetSprite("JN_dk_0");
			}
			if (rowData != null)
			{
				Vector3 localPosition = go.transform.localPosition;
				Vector3 vector = new Vector3(base.uiBehaviour.m_SkillPool.TplPos.x + (float)((int)(rowData.XPostion - 1) * base.uiBehaviour.m_SkillPool.TplWidth), (float)rowData.YPostion);
				Vector3 vector2 = (localPosition + vector) / 2f;
				GameObject gameObject2 = base.uiBehaviour.m_ArrowPool.FetchGameObject(false);
				IXUISprite ixuisprite8 = gameObject2.GetComponent("XUISprite") as IXUISprite;
				if (skillConfig.XPostion == rowData.XPostion || skillConfig.YPostion == rowData.YPostion)
				{
					if (skillConfig.XPostion == rowData.XPostion)
					{
						ixuisprite8.SetSprite("SkillTree_3");
						ixuisprite8.spriteHeight = (int)((float)(rowData.YPostion - skillConfig.YPostion) - (float)ixuisprite2.spriteHeight * 1.5f);
						ixuisprite8.spriteWidth = base.uiBehaviour.m_ArrowPool.TplWidth;
						gameObject2.transform.localPosition = vector2;
						gameObject2.transform.localScale = new Vector3(1f, 1f);
						gameObject2.transform.localRotation = Quaternion.identity;
					}
					else
					{
						ixuisprite8.SetSprite("SkillTree_3");
						int num = (skillConfig.XPostion < rowData.XPostion) ? 1 : -1;
						ixuisprite8.spriteHeight = (int)((float)((int)(rowData.XPostion - skillConfig.XPostion) * (num * base.uiBehaviour.m_SkillPool.TplWidth)) - (float)ixuisprite2.spriteWidth * 1.5f);
						ixuisprite8.spriteWidth = base.uiBehaviour.m_ArrowPool.TplWidth;
						gameObject2.transform.localPosition = vector2;
						gameObject2.transform.localScale = new Vector3(1f, 1f);
						gameObject2.transform.localRotation = Quaternion.Euler(0f, 0f, (float)(-(float)num * 90));
					}
				}
				else
				{
					ixuisprite8.SetSprite("SkillTree_4");
					ixuisprite8.spriteHeight = (int)Math.Abs(localPosition.y - vector.y) - ixuisprite2.spriteHeight / 2;
					ixuisprite8.spriteWidth = (int)Math.Abs(localPosition.x - vector.x) - ixuisprite2.spriteWidth / 2;
					int num2 = (skillConfig.XPostion < rowData.XPostion) ? 1 : -1;
					gameObject2.transform.localPosition = vector2 + new Vector3((float)(ixuisprite2.spriteWidth / 2 * -(float)num2), (float)(ixuisprite2.spriteHeight / 2));
					gameObject2.transform.localScale = new Vector3((float)num2, 1f);
					gameObject2.transform.localRotation = Quaternion.identity;
				}
			}
			ixuisprite2.SetEnabled(skillOriginalLevel > 0U);
			ixuisprite3.SetEnabled(skillOriginalLevel > 0U);
			ixuisprite5.SetVisible(skillOriginalLevel == 0U);
			ixuisprite5.SetEnabled(skillOriginalLevel > 0U);
			ixuisprite2.ID = (ulong)skillID;
		}

		// Token: 0x0600C501 RID: 50433 RVA: 0x002B4420 File Offset: 0x002B2620
		private void OnSkillClicked(IXUISprite sp)
		{
			this._doc.CurrentSkillID = (uint)sp.ID;
			if (this._LastSelect != null)
			{
				this._LastSelect.SetActive(false);
			}
			this._LastSelect = sp.gameObject.transform.Find("Select").gameObject;
			this._LastSelect.SetActive(true);
			this._CurrentSkillSprite = sp.gameObject.transform.Find("RedPoint").gameObject;
			this.SetupDetail(true);
		}

		// Token: 0x0600C502 RID: 50434 RVA: 0x002B44B4 File Offset: 0x002B26B4
		private void OnSetupSkillClicked(IXUISprite sp)
		{
			uint currentSkillID = this._doc.CurrentSkillID;
			uint slot = (uint)sp.ID;
			uint skillSlotUnLockLevel = this._doc.GetSkillSlotUnLockLevel((int)sp.ID);
			if (skillSlotUnLockLevel > XSingleton<XAttributeMgr>.singleton.XPlayerData.Level)
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("OpenSkillAtLevel", new object[]
				{
					skillSlotUnLockLevel
				}), "fece00");
				this.SetupBaseSkill();
			}
			else
			{
				this._doc.SendBindSkill(currentSkillID, slot);
			}
		}

		// Token: 0x0600C503 RID: 50435 RVA: 0x002B4540 File Offset: 0x002B2740
		private bool TurnSwitchFrameState(IXUIButton btn)
		{
			this._SwitchFrameState = !this._SwitchFrameState;
			this.SetupDetail(true);
			int num = this._SwitchFrameState ? 1 : 0;
			base.uiBehaviour.m_DetailFrameTween.StopTweenByGroup(1 - num);
			base.uiBehaviour.m_CatchFrameTween.StopTweenByGroup(1 - num);
			base.uiBehaviour.m_DetailFrameTween.SetTweenGroup(num);
			base.uiBehaviour.m_CatchFrameTween.SetTweenGroup(num);
			base.uiBehaviour.m_DetailFrameTween.PlayTween(true, -1f);
			base.uiBehaviour.m_CatchFrameTween.PlayTween(true, -1f);
			return true;
		}

		// Token: 0x0600C504 RID: 50436 RVA: 0x002B45F4 File Offset: 0x002B27F4
		public void SetupDetail(bool resetSnap = true)
		{
			uint skillOriginalLevel = XSingleton<XAttributeMgr>.singleton.XPlayerData.SkillLevelInfo.GetSkillOriginalLevel(this._doc.CurrentSkillID);
			SkillList.RowData skillConfig = XSingleton<XSkillEffectMgr>.singleton.GetSkillConfig(this._doc.CurrentSkillID, skillOriginalLevel);
			if (skillConfig == null)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("Can't find Current Skill, SkillID = ", this._doc.CurrentSkillID.ToString(), null, null, null, null);
			}
			else
			{
				SkillTypeEnum skillType = (SkillTypeEnum)skillConfig.SkillType;
				bool flag2 = false;
				bool flag3 = false;
				bool flag4 = (ulong)skillOriginalLevel < (ulong)((long)XSingleton<XSkillEffectMgr>.singleton.GetSkillMaxLevel(this._doc.CurrentSkillID, 0U));
				if (skillType == SkillTypeEnum.Skill_Normal || skillType == SkillTypeEnum.Skill_Big || skillType == SkillTypeEnum.Skill_Help || skillType == SkillTypeEnum.Skill_Buff)
				{
					flag2 = true;
				}
				if (skillOriginalLevel > 0U)
				{
					if (!this._doc.IsExSkill(skillConfig))
					{
						if (skillType == SkillTypeEnum.Skill_Normal || skillType == SkillTypeEnum.Skill_Big || skillType == SkillTypeEnum.Skill_Buff)
						{
							flag3 = true;
						}
					}
				}
				if (this._doc.CurrentSkillID != this._doc.UNSELECT)
				{
					base.uiBehaviour.m_SkillLearnRedPoint.gameObject.SetActive(this._doc.CheckRedPoint(this._doc.CurrentSkillID));
				}
				else
				{
					base.uiBehaviour.m_SkillLearnRedPoint.gameObject.SetActive(false);
				}
				if (resetSnap)
				{
					XSingleton<XSkillPreViewMgr>.singleton.SkillShowEnd(this._doc.Dummy);
					XSingleton<XSkillPreViewMgr>.singleton.SkillShowBegin(this._doc.Dummy, this._doc.BlackHouseCamera);
				}
				base.uiBehaviour.m_NonPreView.SetActive(!flag2);
				base.uiBehaviour.m_Snapshot.SetVisible(flag2);
				base.uiBehaviour.m_SkillPlayBtn.SetVisible(flag2);
				base.uiBehaviour.m_ChooseBtn.SetVisible(flag3);
				if (flag3)
				{
					Vector3 localPosition = base.uiBehaviour.m_ChooseBtn.gameObject.transform.localPosition;
					if (flag4)
					{
						base.uiBehaviour.m_ChooseBtn.gameObject.transform.localPosition = new Vector3(96f, localPosition.y);
					}
					else
					{
						base.uiBehaviour.m_ChooseBtn.gameObject.transform.localPosition = new Vector3(0f, localPosition.y);
					}
				}
				if (!flag3 && !this._SwitchFrameState)
				{
					this.TurnSwitchFrameState(null);
				}
				base.uiBehaviour.m_LearnBtn.SetVisible(flag4);
				if (flag4)
				{
					Vector3 localPosition2 = base.uiBehaviour.m_LearnBtn.gameObject.transform.localPosition;
					if (flag3)
					{
						base.uiBehaviour.m_LearnBtn.gameObject.transform.localPosition = new Vector3(-96f, localPosition2.y);
					}
					else
					{
						base.uiBehaviour.m_LearnBtn.gameObject.transform.localPosition = new Vector3(0f, localPosition2.y);
					}
				}
				IXUISprite ixuisprite = base.uiBehaviour.m_LearnBtn.gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
				ItemList.RowData itemConf = XBagDocument.GetItemConf(skillConfig.IsAwake ? XFastEnumIntEqualityComparer<ItemEnum>.ToInt(ItemEnum.AWAKE_SKILL_POINT) : XFastEnumIntEqualityComparer<ItemEnum>.ToInt(ItemEnum.SKILL_POINT));
				if (itemConf != null && itemConf.ItemAtlas1.Length != 0 && itemConf.ItemIcon1.Length != 0)
				{
					ixuisprite.SetSprite(itemConf.ItemIcon1[0], itemConf.ItemAtlas1[0], false);
				}
				IXUILabel ixuilabel = base.uiBehaviour.m_LearnBtn.gameObject.transform.Find("Text").GetComponent("XUILabel") as IXUILabel;
				ixuilabel.SetText(XStringDefineProxy.GetString((skillOriginalLevel == 0U) ? "LEARN" : "UPGRADE"));
				IXUILabel ixuilabel2 = base.uiBehaviour.m_LearnBtn.gameObject.transform.Find("Cost").GetComponent("XUILabel") as IXUILabel;
				if (skillConfig.LevelupCost == null)
				{
					ixuilabel2.SetText("0");
				}
				else
				{
					if ((ulong)skillOriginalLevel < (ulong)((long)skillConfig.LevelupCost.Length))
					{
						ixuilabel2.SetText(skillConfig.LevelupCost[(int)skillOriginalLevel].ToString());
					}
					else
					{
						ixuilabel2.SetText(skillConfig.LevelupCost[skillConfig.LevelupCost.Length - 1].ToString());
					}
				}
				base.uiBehaviour.m_LearnBtn.SetGrey(this._doc.CheckLevelUpButton(this._doc.CurrentSkillID));
				this.SetupDetailMsg(this._doc.CurrentSkillID, skillOriginalLevel, skillConfig);
				this.SetupBaseSkill();
			}
		}

		// Token: 0x0600C505 RID: 50437 RVA: 0x002B4AF4 File Offset: 0x002B2CF4
		private void SetupBaseSkill()
		{
			SkillList.RowData skillConfig = XSingleton<XSkillEffectMgr>.singleton.GetSkillConfig(this._doc.CurrentSkillID, 0U);
			SkillTypeEnum skillType = (SkillTypeEnum)skillConfig.SkillType;
			bool isAwake = skillConfig.IsAwake;
			for (int i = 0; i < XSkillTreeDocument.SkillSlotCount; i++)
			{
				//bool flag = i == 0 || i == 1;
				if (/*!flag*/i != 0 && i != 1)
				{
					if (i == XSkillTreeDocument.AwakeSkillSlot)
					{
						base.uiBehaviour.m_SkillSlotList[i].gameObject.SetActive(this._doc.IsAwakeSkillSlotOpen && this._doc.IsSelfAwaked);
					}
					uint num = 0U;
					if (i < XSingleton<XAttributeMgr>.singleton.XPlayerData.skillSlot.Length)
					{
						num = XSingleton<XAttributeMgr>.singleton.XPlayerData.skillSlot[i];
					}
					SkillTypeEnum skillSlotType = this._doc.GetSkillSlotType(i);
					IXUISprite ixuisprite = base.uiBehaviour.m_SkillSlotList[i].gameObject.transform.Find("Light").GetComponent("XUISprite") as IXUISprite;
					IXUISprite ixuisprite2 = base.uiBehaviour.m_SkillSlotList[i].gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
					IXUISprite ixuisprite3 = base.uiBehaviour.m_SkillSlotList[i].gameObject.transform.Find("Lock").GetComponent("XUISprite") as IXUISprite;
					BoxCollider boxCollider = base.uiBehaviour.m_SkillSlotList[i].gameObject.GetComponent("BoxCollider") as BoxCollider;
					if (skillConfig.ExSkillScript == "")
					{
						ixuisprite.SetVisible(num == this._doc.CurrentSkillID);
					}
					else
					{
						uint skillID = XSingleton<XSkillEffectMgr>.singleton.GetSkillID(skillConfig.ExSkillScript, 0U);
						ixuisprite.SetVisible(num == this._doc.CurrentSkillID || num == skillID);
					}
					if (skillSlotType == skillType)
					{
						base.uiBehaviour.m_SkillSlotList[i].SetAlpha(1f);
						boxCollider.enabled = true;
					}
					else
					{
						base.uiBehaviour.m_SkillSlotList[i].SetAlpha(0.5f);
						boxCollider.enabled = false;
					}
					ixuisprite3.SetAlpha((this._doc.GetSkillSlotUnLockLevel(i) > XSingleton<XAttributeMgr>.singleton.XPlayerData.Level) ? 1f : 0f);
					if (skillSlotType == SkillTypeEnum.Skill_Buff && this._doc.GetSkillSlotUnLockLevel(XFastEnumIntEqualityComparer<XSkillSlot>.ToInt(XSkillSlot.Skill_1_Buff)) > XSingleton<XAttributeMgr>.singleton.XPlayerData.Level)
					{
						base.uiBehaviour.m_SkillSlotList[i].SetAlpha(0f);
					}
					if (num > 0U)
					{
						uint skillOriginalLevel = XSingleton<XAttributeMgr>.singleton.XPlayerData.SkillLevelInfo.GetSkillOriginalLevel(num);
						SkillList.RowData skillConfig2 = XSingleton<XSkillEffectMgr>.singleton.GetSkillConfig(num, skillOriginalLevel);
						ixuisprite2.SetSprite(skillConfig2.Icon, skillConfig2.Atlas, false);
					}
					else
					{
						ixuisprite2.spriteName = "EmptySkill";
					}
				}
			}
		}

		// Token: 0x0600C506 RID: 50438 RVA: 0x002B4E28 File Offset: 0x002B3028
		private void SetupDetailMsg(uint skillID, uint skillLevel, SkillList.RowData data)
		{
			SkillTypeEnum skillType = (SkillTypeEnum)data.SkillType;
			string text = string.Format("{0}({1}/{2})", data.ScriptName, skillLevel, XSingleton<XSkillEffectMgr>.singleton.GetSkillMaxLevel(skillID, 0U));
			base.uiBehaviour.m_SkillName_L.SetText(text);
			base.uiBehaviour.m_SkillName_S.SetText(text);
			string @string;
			switch (skillType)
			{
			case SkillTypeEnum.Skill_Big:
				@string = XStringDefineProxy.GetString("SPECIAL_SKILL");
				goto IL_CE;
			case SkillTypeEnum.Skill_SceneBuff:
				@string = XStringDefineProxy.GetString("SCENEBUFF_SKILL");
				goto IL_CE;
			case SkillTypeEnum.Skill_Help:
				@string = XStringDefineProxy.GetString("SUPPORT_SKILL");
				goto IL_CE;
			case SkillTypeEnum.Skill_Buff:
				@string = XStringDefineProxy.GetString("BUFF_SKILL");
				goto IL_CE;
			case SkillTypeEnum.Skill_Awake:
				@string = XStringDefineProxy.GetString("AWAKE_SKILL");
				goto IL_CE;
			}
			@string = XStringDefineProxy.GetString("NORMAL_SKILL");
			IL_CE:
			base.uiBehaviour.m_SkillType_L.SetText(@string);
			base.uiBehaviour.m_SkillType_S.SetText(@string);
			base.uiBehaviour.m_ChooseTips.SetText(string.Format(XStringDefineProxy.GetString("SKILL_CHOOSE_TIPS"), @string));
			base.uiBehaviour.m_SkillCostText.SetText((data.CostMP[0] + data.CostMP[1] * skillLevel).ToString());
			base.uiBehaviour.m_SkillAttrText.SetText(XSkillTreeDocument.GetSkillAttrStr((int)data.Element));
			if (skillType != SkillTypeEnum.Skill_SceneBuff)
			{
				base.uiBehaviour.m_SkillCDText.SetText(string.Format("{0}s", Math.Round((double)XSkillMgr.GetCD(this._doc.Player, data.SkillScript, 0U) + 0.01, 1)));
			}
			else
			{
				base.uiBehaviour.m_SkillCDText.SetText(XStringDefineProxy.GetString("NONE"));
			}
			base.uiBehaviour.m_SkillDetail_L.SetText(data.CurrentLevelDescription);
			base.uiBehaviour.m_SkillDetail_S.SetText(data.CurrentLevelDescription);
			base.uiBehaviour.m_SkillDetailScrollView_S.SetPosition(0f);
			uint preSkill = XSingleton<XSkillEffectMgr>.singleton.GetPreSkill(skillID, 0U);
			uint num = 0U;
			if (preSkill > 0U)
			{
				num = XSingleton<XAttributeMgr>.singleton.XPlayerData.SkillLevelInfo.GetSkillOriginalLevel(preSkill);
			}
			float num2;
			float num3;
			XSingleton<XSkillEffectMgr>.singleton.GetSkillDescriptValue(skillID, (preSkill == 0U) ? skillLevel : num, XSingleton<XGame>.singleton.Doc.XBagDoc.EmblemBag, out num2, out num3);
			base.uiBehaviour.m_SkillCurrDesc.SetText(string.Format(XSingleton<UiUtility>.singleton.ReplaceReturn(data.NextLevelDescription), Math.Round((double)(num2 * 100f) + 0.01, 1), Math.Round((double)num3 + 0.01, 1)));
			base.uiBehaviour.m_SkillPreSkillPointTips.SetVisible(false);
			if (num == 0U)
			{
				num += 1U;
			}
			XSingleton<XSkillEffectMgr>.singleton.GetSkillDescriptValue(skillID, (preSkill == 0U) ? (skillLevel + 1U) : num, XSingleton<XGame>.singleton.Doc.XBagDoc.EmblemBag, out num2, out num3);
			base.uiBehaviour.m_SkillNextDesc.SetText(string.Format(XSingleton<UiUtility>.singleton.ReplaceReturn(data.NextLevelDescription), Math.Round((double)(num2 * 100f) + 0.01, 1), Math.Round((double)num3 + 0.01, 1)));
			if (this._doc.CanSkillLevelUp(skillID, skillLevel, 0))
			{
				base.uiBehaviour.m_SkillNextReq.SetText("");
			}
			else
			{
				SkillLevelupRequest levelupRequest = XSingleton<XSkillEffectMgr>.singleton.GetLevelupRequest(skillID, skillLevel);
				base.uiBehaviour.m_SkillNextReq.SetText(string.Format("{0}({1})", string.Format(XStringDefineProxy.GetString(XStringDefine.ITEM_REQUIRE_LEVEL), levelupRequest.Level), string.Format(XStringDefineProxy.GetString("LEFT_LEVEL"), (long)levelupRequest.Level - (long)((ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level))));
			}
			base.uiBehaviour.m_SuperIndureAttack.SetText(data.SuperIndureAttack);
			base.uiBehaviour.m_SuperIndureDenfense.SetText(data.SuperIndureDefense);
			if (skillLevel == 0U)
			{
				base.uiBehaviour.m_SkillCurrDesc.SetText(XStringDefineProxy.GetString("NOT_LEARN"));
				bool isAwake = data.IsAwake;
				int num4 = (isAwake ? this._doc.TotalAwakeSkillPoint : this._doc.TotalSkillPoint) - (int)XSingleton<XGame>.singleton.Doc.XBagDoc.GetSkillPointCount(isAwake);
				if (num4 < (int)data.PreSkillPoint)
				{
					base.uiBehaviour.m_SkillPreSkillPointTips.SetVisible(true);
					base.uiBehaviour.m_SkillPreSkillPointTips.SetText(string.Format(XStringDefineProxy.GetString("SKILLTREE_PRESKILLPOINT_TIPS"), data.PreSkillPoint));
				}
				else
				{
					base.uiBehaviour.m_SkillPreSkillPointTips.SetVisible(false);
				}
			}
			else
			{
				if ((ulong)skillLevel == (ulong)((long)XSingleton<XSkillEffectMgr>.singleton.GetSkillMaxLevel(skillID, 0U)))
				{
					base.uiBehaviour.m_SkillNextDesc.SetText(XStringDefineProxy.GetString("SkillLevelMaxTips"));
					base.uiBehaviour.m_SkillNextReq.SetText("");
				}
			}
			base.uiBehaviour.m_SkillDetailScrollView.ResetPosition();
		}

		// Token: 0x0600C507 RID: 50439 RVA: 0x002B53B8 File Offset: 0x002B35B8
		private void OnResetSkillPointClicked(IXUISprite sp)
		{
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton._bHasGrey = false;
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetSingleButtonMode(false);
			int num = XSingleton<XGlobalConfig>.singleton.GetInt("SkillResetCost");
			if ((ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level < (ulong)((long)XSingleton<XGlobalConfig>.singleton.GetInt("FreeResetSkillLevel")))
			{
				num = 0;
			}
			if (num != 0)
			{
				DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetLabelsWithSymbols(string.Format(XSingleton<UiUtility>.singleton.ReplaceReturn(XStringDefineProxy.GetString(XStringDefine.SKILL_RESET_SP)), num, XLabelSymbolHelper.FormatSmallIcon(7)), XStringDefineProxy.GetString(XStringDefine.COMMON_OK), XStringDefineProxy.GetString(XStringDefine.COMMON_CANCEL));
			}
			else
			{
				DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetLabelsWithSymbols(string.Format(XStringDefineProxy.GetString("FREE_RESET_SKILL_POINT"), XSingleton<XGlobalConfig>.singleton.GetInt("FreeResetSkillLevel")), XStringDefineProxy.GetString(XStringDefine.COMMON_OK), XStringDefineProxy.GetString(XStringDefine.COMMON_CANCEL));
			}
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetModalCallback(new ButtonClickEventHandler(this.OnResetSpConfirmed), null);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetTweenTargetAndPlay(DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.uiBehaviour.gameObject);
		}

		// Token: 0x0600C508 RID: 50440 RVA: 0x002B54D8 File Offset: 0x002B36D8
		private bool OnResetSpConfirmed(IXUIButton go)
		{
			this._doc.SendResetSkill();
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
			return true;
		}

		// Token: 0x0600C509 RID: 50441 RVA: 0x002B5504 File Offset: 0x002B3704
		private void OnResetProfClicked(IXUISprite sp)
		{
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton._bHasGrey = false;
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetSingleButtonMode(false);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetLabelsWithSymbols(string.Format("{0}{1}", string.Format(XStringDefineProxy.GetString(XStringDefine.SKILL_RESET_PROF), XSingleton<XGlobalConfig>.singleton.GetInt("SkillResetProfession")), XLabelSymbolHelper.FormatSmallIcon(7)), XStringDefineProxy.GetString(XStringDefine.COMMON_OK), XStringDefineProxy.GetString(XStringDefine.COMMON_CANCEL));
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetModalCallback(new ButtonClickEventHandler(this.OnResetProfConfirmed), null);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetTweenTargetAndPlay(DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.uiBehaviour.gameObject);
		}

		// Token: 0x0600C50A RID: 50442 RVA: 0x002B55B0 File Offset: 0x002B37B0
		private bool OnResetProfConfirmed(IXUIButton go)
		{
			this._doc.SendResetProf();
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
			return true;
		}

		// Token: 0x0600C50B RID: 50443 RVA: 0x002B55DC File Offset: 0x002B37DC
		private void OnSwitchSkillPageBtnClick(IXUISprite iSp)
		{
			if ((ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level < (ulong)((long)this._doc.SkillPageOpenLevel))
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("SkillPageOpenTips"), "fece00");
			}
			else
			{
				if (Time.time - this._skillPageSwitchSignTime < 2f)
				{
					XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("SkillPageSwitchTooOften"), "fece00");
				}
				else
				{
					this._skillPageSwitchSignTime = Time.time;
					this._doc.QuerySwitchSkillPage();
				}
			}
		}

		// Token: 0x0600C50C RID: 50444 RVA: 0x002B5674 File Offset: 0x002B3874
		public void OnSkillLevelUp(int x, int y)
		{
			if (base.IsVisible())
			{
				base.uiBehaviour.m_LevelUpFx.gameObject.transform.localPosition = new Vector3(base.uiBehaviour.m_SkillPool.TplPos.x + (float)((x - 1) * base.uiBehaviour.m_SkillPool.TplWidth), (float)y);
				base.uiBehaviour.m_LevelUpFx.SetActive(false);
				base.uiBehaviour.m_LevelUpFx.SetActive(true);
			}
		}

		// Token: 0x0600C50D RID: 50445 RVA: 0x002B5704 File Offset: 0x002B3904
		public void SetLearnSkillButtonState(bool state)
		{
			if (DlgBase<XSkillTreeView, XSkillTreeBehaviour>.singleton.IsVisible())
			{
				base.uiBehaviour.m_LearnBtn.SetEnable(state, false);
			}
		}

		// Token: 0x0600C50E RID: 50446 RVA: 0x002B5738 File Offset: 0x002B3938
		public void CreateAndPlayFxFxFirework()
		{
			XSingleton<XAudioMgr>.singleton.PlayUISound("Audio/UI/zhuanzhi", true, AudioChannel.Action);
			this.DestroyFx(this._FxFirework);
			this._FxFirework = null;
			this._FxFirework = XSingleton<XFxMgr>.singleton.CreateFx("Effects/FX_Particle/UIfx/UI_zzcg", null, true);
			this._FxFirework.Play(base.uiBehaviour.m_FxFirework, Vector3.zero, Vector3.one, 1f, true, false);
		}

		// Token: 0x0600C50F RID: 50447 RVA: 0x002B57AC File Offset: 0x002B39AC
		public void DestroyFx(XFx fx)
		{
			if (fx != null)
			{
				XSingleton<XFxMgr>.singleton.DestroyFx(fx, true);
			}
		}

		// Token: 0x0600C510 RID: 50448 RVA: 0x002B57D1 File Offset: 0x002B39D1
		private void OnUnableCheckBoxClick(IXUISprite iSp)
		{
			XSingleton<UiUtility>.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetString("CHANGEPROF_PRETIPS"), iSp.ID), "fece00");
		}

		// Token: 0x0600C511 RID: 50449 RVA: 0x002B5800 File Offset: 0x002B3A00
		private int Compare(SkillTreeSortItem x, SkillTreeSortItem y)
        {
            int result;
			if (x.skillID == y.skillID)
			{
				result = 0;
			}
			else
			{
				if (x.y != y.y)
				{
					result = y.y - x.y;
				}
				else
				{
					result = x.x - y.x;
				}
			}
			return result;
		}

		// Token: 0x0600C512 RID: 50450 RVA: 0x002B585C File Offset: 0x002B3A5C
		public void SetUVRectangle()
		{
			Rect rect = this._doc.BlackHouseCamera.rect;
			rect.y = (rect.y * 208f + 1f) / 208f;
			rect.height = (rect.height * 208f - 2f) / 208f;
			base.uiBehaviour.m_Snapshot.SetUVRect(rect);
		}

		// Token: 0x04005612 RID: 22034
		public SkillDlgPromoteHandler _skillDlgPromoteHandler;

		// Token: 0x04005613 RID: 22035
		private GameObject _LastSelect = null;

		// Token: 0x04005614 RID: 22036
		private GameObject _CurrentSkillSprite = null;

		// Token: 0x04005615 RID: 22037
		private List<GameObject> _TabRedPointList = new List<GameObject>();

		// Token: 0x04005616 RID: 22038
		private bool _SwitchFrameState = true;

		// Token: 0x04005617 RID: 22039
		public bool IsPromoteHandlerShow = false;

		// Token: 0x04005618 RID: 22040
		public int LastSelectPromote;

		// Token: 0x04005619 RID: 22041
		private XSkillTreeDocument _doc = null;

		// Token: 0x0400561A RID: 22042
		private List<IXUICheckBox> _icbList = new List<IXUICheckBox>();

		// Token: 0x0400561B RID: 22043
		public RenderTexture skillPreView;

		// Token: 0x0400561C RID: 22044
		private float _skillPageSwitchSignTime = 0f;

		// Token: 0x0400561D RID: 22045
		private XFx _FxFirework;

		// Token: 0x0400561E RID: 22046
		private int[] MI = new int[]
		{
			1,   //
			10,  //转
			100,  //一
			1000,  //二转
			10000  //觉醒
		};

		// Token: 0x0400561F RID: 22047
		public static readonly int AwakeIndex = 3;  //觉醒
	}
}
